#include <unistd.h>

#include "assembler.h"

void assemble(file_t f) {
	printf("assembling %s...\n", f->name);

	extern void test(file_t);
	test(f);
}

int main(int argc, char **argv) {
	int flag;
	while(-1 != (flag = getopt(argc, argv, ""))) {
		switch(flag) {
		case '?':
		default:
			return 1;
		}
	}

	int i;
	for(i = optind; i < argc; i++) {
		struct file f = {
			name: argv[i],
			file: fopen(argv[i], "r"),
			line: 1,
		};
		if(!f.file) {
			fprintf(stderr, "could not open %s\n", argv[i]);
			return 1;
		}
		assemble(&f);
	}
	
	return 0;
}
